package com.ujson.cloud.center.gateway;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import reactor.netty.ReactorNetty;

/**
 * <h3>ujson-parent</h3>
 * <p>spring cloud gateway</p>
 *
 * @author JerryLiu  a1031757312@gmail.com
 * @version 1.0
 * @date 2021-11-21 09:47
 */
@EnableDiscoveryClient
@SpringBootApplication
public class GatewayApplication {

    public static void main(String[] args) {
        System.setProperty(ReactorNetty.NATIVE,"false");
        System.setProperty(ReactorNetty.IO_WORKER_COUNT, "8");
        System.setProperty(ReactorNetty.IO_SELECT_COUNT, "2");
        SpringApplication.run(GatewayApplication.class, args);
    }

    /** 代码实现路由 */
    /*@Bean
    public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
        return builder.routes()
                .route("uaa-provider-route", r -> r.path("/uaa/**").uri("lb://uaa-provider"))
                .build();
    }*/
}
